<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>交易列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
</head>
<body>

<table class="layui-hide" id="test"></table>

<script src="../../layuiadmin/layui/layui.js"></script>
<script>
    layui.use('table', function(){
        var table = layui.table;
        var localTest = layui.sessionData('test');
        var blockNumber = getQueryVariable('blockNumber');

        console.info(blockNumber)
        table.render({
            elem: '#test'
            ,url:'http://'+localTest.address+'/http/blockChain/transaction'
            ,where:{blockNumber:blockNumber}
            ,cols: [[
                {field:'hash', width:300, title: 'Hash'}
                ,{field:'from', width:250, title: '发送方'}
                ,{field:'to', width:250, title: '接收方'}
                ,{field:'file_id', width:200, title: '文件ID'}
                ,{field:'timestamp', width:200, title: '时间'}
                ,{field:'type', width:80, title: '类型'}
                ,{field:'value', width:80, title: '价值'}
            ]]
            ,page: false
        });
    });

    function getQueryVariable(variable)
    {
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i=0;i<vars.length;i++) {
            var pair = vars[i].split("=");
            if(pair[0] == variable){return pair[1];}
        }
        return(false);
    }
</script>

</body>
</html>